<?php
session_start();
$username = $_SESSION['username'];
$password = $_SESSION['password'];
$id = $_REQUEST['id'];
$title = $_REQUEST['title'];
$description = $_REQUEST['description'];

$url_ = explode("/", $id);

$url = "http://localhost:8080/moms-diary/services/picture/gallery/".$url_[3];
//$username="rm.herwidodo@babytivities.com";
//$password="e8HSG6Mlj>";

$postFields = array();

//files
$postFields['title'] = $title;
$postFields['description'] = $description;

$auth = $username.":".$password;
 
$curl_handle = curl_init($url);

curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_handle, CURLOPT_USERPWD, $auth);
curl_setopt($curl_handle, CURLOPT_POST, true);
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array("Content-type: application/x-www-form-urlencoded"));
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $postFields);

//execute the API Call
$returned_data = curl_exec($curl_handle);
$return =  curl_getinfo($curl_handle);

echo $returned_data;


